﻿using System;
using System.Collections;
using System.ComponentModel.Design;

namespace DiveDeeper.VsxLibrary.Core.MenuCommandService
{
  public abstract class MenuCommandDefinition
  {
    #region Private fields

    private readonly uint _Id;

    #endregion

    #region Lifecycle methods

    protected MenuCommandDefinition()
    {
      foreach (object attr in GetType().GetCustomAttributes(false))
      {
        CommandIDAttribute idAttr = attr as CommandIDAttribute;
        if (idAttr != null)
        {
          _Id = idAttr.Value;
        }
      }
    }

    #endregion

    #region Public properties

    public Guid Guid
    {
      get { return GetType().GUID; }
    }

    public uint Id
    {
      get { return _Id; }
    }

    #endregion

    #region Public methods

    public bool Invoke()
    {
      return false;
    }

    public bool Invoke(object arg)
    {
      return false;
    }

    public void ShowContextMenu(int x, int y)
    {
      
    }

    #endregion

    #region Static methods and events

    public static void AddCommand(Type type)
    {
    }

    public static void FindCommand(Type type)
    {
    }

    public static ICollection GetCommandList(Guid guid)
    {
      return null;
    }

    public static ICollection GetCommandList(Type type)
    {
      return null;
    }

    public static bool GlobalInvoke(Type type)
    {
      return false;
    }

    public static bool GlobalInvoke(Type type, object arg)
    {
      return false;
    }

    public static void RemoveCommand(Type type)
    {
    }

    public static void ShowContextMenu(Type type, int x, int y)
    {
    }

    public event MenuCommandsChangedEventHandler MenuCommandsChanged;

    #endregion
  }
}
